/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import React from "react";
import { Link } from "dva/router";
import PageHeader from "@/components/PageHeader";
import styles from "./PageHeaderLayout.less";
import Context from "./MenuContext";

export default ({ children, wrapperClassName, top, ...restProps }) => (
  <div style={{ margin: "-24px -24px 0" }} className={wrapperClassName}>
    {top}
    <Context.Consumer>
      {
        value => (<PageHeader
          {...value}
          key="pageheader"
          {...restProps}
          linkElement={Link}
        />)
      }
    </Context.Consumer>

    {children ? <div className={styles.content}>{children}</div> : null}
  </div>
);
